home *** CD-ROM | disk | FTP | other *** search
/ MacAddict 84 / MacAddict_084_2003_08.iso / pc / Software / Audio & Music / Audacity 1.1.3.dmg / nyquist / system.lsp < prev    next >
Lisp/Scheme  |  2002-09-16  |  2KB  |  81 lines

  1. ;; system.lsp -- system-dependent lisp code
  2.  
  3. ; local definition for play
  4. ;  this one is for Linux:
  5.  
  6. (setf ny:bigendianp nil)
  7.  
  8. (if (not (boundp '*default-sf-format*))
  9.     (setf *default-sf-format* snd-head-wave))
  10.  
  11. (if (not (boundp '*default-sound-file*))
  12.     (setf *default-sound-file* NIL))
  13.  
  14. (if (not (boundp '*default-sf-dir*))
  15.     (setf *default-sf-dir* "./"))
  16.  
  17. (if (not (boundp '*default-sf-mode*))
  18.     (setf *default-sf-mode* snd-head-mode-pcm))
  19.  
  20. (if (not (boundp '*default-sf-bits*))
  21.     (setf *default-sf-bits* 16))
  22.  
  23. (if (not (boundp '*default-plot-file*))
  24.     (setf *default-plot-file* "points.dat"))
  25.  
  26.  
  27. ; FULL-NAME-P -- test if file name is a full path or relative path
  28. ;
  29. ; (otherwise the *default-sf-dir* will be prepended
  30. ;
  31. (defun full-name-p (filename)
  32.   (or (eq (char filename 0) #\/)
  33.       (eq (char filename 0) #\.)))
  34.  
  35.  
  36. (setf *file-separator* #\/)
  37.  
  38.  
  39. ;; PLAY-FILE - play a sound file
  40. ;;
  41. (defun play-file (name)
  42. ;;  (system (strcat "sndplay " (soundfilename name))))
  43.   (system (strcat "play " (soundfilename name) )))
  44.  
  45. ;; R - replay last file written with PLAY
  46. (defun r () (play-file *default-sound-file*))
  47.  
  48. ;;;; use this old version if you want to use sndplay to play
  49. ;;;; the result file rather than play the samples as they
  50. ;;;; are computed. This version does not autonormalize.
  51. ;; PLAY - write value of an expression to file and play it
  52. ;;
  53. ;(defmacro play (expr)
  54. ;  `(prog (specs)
  55. ;     (setf specs (s-save (force-srate *sound-srate* ,expr) 
  56. ;               1000000000 *default-sound-file*))
  57. ;     (r)))
  58. ;;;;
  59.  
  60. ; local definition for play
  61. (defmacro play (expr)
  62.   `(s-save-autonorm ,expr NY:ALL *default-sound-file* :play *soundenable*))
  63.  
  64. ;; for Linux, modify s-plot (defined in nyquist.lsp) by saving s-plot
  65. ;; in standard-s-plot, then call gnuplot to display the points.
  66. ;;
  67. ;; we also need to save the location of this file so we can find
  68. ;; nyquist-plot.txt, the command file for gnuplot
  69. ;;
  70. (setf *runtime-path* (current-path))
  71. (display "system.lsp" *runtime-path*)
  72.  
  73. (setfn standard-s-plot s-plot)
  74.  
  75. (defun s-plot (s)
  76.   (let (plot-file)
  77.     (standard-s-plot s) ;; this calculates the data points
  78.     (setf plot-file (strcat *runtime-path* "nyquist-plot.txt"))
  79.     (system (strcat "gnuplot -persist " plot-file))))
  80.  
  81.